<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>comment</title>
	<link rel="stylesheet" type="text/css" href="../easyui/1.3.4/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="../css/wu.css" />
	<link rel="stylesheet" type="text/css" href="../css/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="../js/jquery.serializejson.min.js"></script>
	<script type="text/javascript" src="../easyui/1.3.4/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="../public/xheditor/xheditor-1.2.2.min.js"></script>
</head>
<body>
	<form id="ff" class="easyui-form" method="post" data-options="novalidate:true">
        <div style="margin-bottom:20px;margin-top: 50px;">
        	<span style="margin-right: 45px;">标题:</span>
            <input class="easyui-textbox" name="title" style="width:80%" data-options="label:'标题:',required:true">
        </div>		
		<div style="margin-bottom:20px">
			<span style="margin-right: 45px;">正文：</span>
            <textarea class="textarea easyui-validatebox xheditor" name="content" style="width:80%;height:300px;" data-options="label:'',required:true"></textarea>
        </div>
		<div style="margin-bottom:20px">
			<span style="margin-right: 45px;">作者:</span>
            <input class="easyui-textbox" name="author" style="width:80%" data-options="label:'作者:',required:true">
        </div>
        
    </form>

    <div style="text-align: center;padding: 5px 0">
        <a href="javascript:;void(0)" class="easyui-linkbutton" onclick="commentAddAction()">submit</a>
        <a href="javascript:;void(0)" class="easyui-linkbutton" onclick="clearForm()" >clear</a>
    </div>
</body>

<script type="text/javascript">
	function commentAddAction(){
         $('#ff').form('submit',{
            onSubmit:function(){
                if ($(this).form('enableValidation').form('validate')){
                    $.ajax({
                        type:"post",
                        url:"http://localhost:3000/comment/data",
                        data:$("#ff").serializeJSON()
                    }).then(function(res){
                        console.log(res)
                    });
                }else{
                    alert('no')
                }
            }
        });
         $('#ff').form('clear');
         /*addTab('分类管理','cate/cate.html',null,1);*/
    }

     function clearForm(){
        $('#ff').form('clear');
    }
</script>
</html>